package com.edu.course.controller;

import com.edu.api.entity.common.Code;
import com.edu.api.entity.common.Page;
import com.edu.api.entity.common.ResponseDTO;
import com.edu.api.entity.coursedto.CourseDto;
import com.edu.course.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @description: 描述
 * @author: xnylh
 * @createDate: 2023/1/4 0004 20:06
 */
@RestController
@RequestMapping("course")
public class CourseController {
    @Autowired
    CourseService courseService;

    @GetMapping("/updateSales")
    public ResponseDTO updateSales(@RequestParam String courseId){
        return courseService.updateSales(courseId);
    }

    @GetMapping("/getAllCourse")
    public ResponseDTO getAllCourse(@RequestParam Map map, HttpServletRequest request){
        return courseService.getAllCourse(map,request);
    }

    @GetMapping("/getMyCourseById")
    public ResponseDTO getMyCourseById(HttpServletRequest request){
        return courseService.getMyCoursesById(request);
    }

    @GetMapping("/getCourseDetails")
    public ResponseDTO getCourseDetails(String courseId){
        return courseService.getCourseDetails(courseId);
    }
}
